home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: ZoomBlur.ieb 1.11, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 2/2 1997 Stockholm/Sweden ** ** Blur image with blur, max or min, using zooming technique. ** Based on the ZoomBlur.rexx script by Simon Edwards. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Level=5 if command ~= '' then parse var command '#'Method Level . 'IE_TO_FRONT' form = 'FORM "Zoom Blur" " OK | Cancel "', ' INTEGER,"Zoom level",0,50,'Level',SLIDER' if command = '' then do form = form||' CYCLE,"Method:","Mix, (blur)|Max, (brighten) |Min, (darken)",0' form parse var result ok Level Method . if ok = 0 then return '<ERROR>' end else do form parse var result ok Level . if ok = 0 then return '<ERROR>' Method = 'none' end back = '#'Method Level return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' parse var options '#'Method Level . 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result if Method = 0 then Method = 'MIX 50' if Method = 1 then Method = 'MAX' if Method = 2 then Method = 'MIN' Step = 2 'PROJECT_INFO' LoadImage 'WIDTH' /* Get width of image */ IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' /* Get height of image */ IH = RESULT if Level ~= 0 then do do w = 1 to Level 'SCALE' LoadImage IW+Step*w IH+Step*w 'BEST' ScaleImage = result 'MARK' ScaleImage 'PRIMARY' 'MARK' LoadImage 'SECONDARY' 'COMPOSITE' trunc(w*Step/(-2)) trunc(w*Step/(-2)) Method CompImage = result 'CLOSE' ScaleImage 'CLOSE' LoadImage LoadImage = CompImage end end OutputImage = LoadImage 'SAVE_DATA' OutputImage '"'dst_image'"' '"ILBM CmpByteRun1"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'